package com.rose.redis.lua;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * test
 * </p>
 *
 * @author: zhu.chen
 * @date: 2021/1/5
 * @version: v1.0.0
 */
//@Component
public class TestLuaCommandLineRunner implements CommandLineRunner {

    @Autowired
    private DefaultRedisScript<Boolean> redisScript;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Override
    public void run(String... args) throws Exception {
        List<String> keys = Arrays.asList("testLua", "hello lua");
        stringRedisTemplate.execute(redisScript, keys, "100");
    }

}
